<%@page contentType="text/html;charset=UTF-8" language = "java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<html>
	<head>
		<title>文件上传 | JWiki</title>
		<link rel="stylesheet" href="texts/style.css" type="text/css" />
		<script language = "javascript">
		function getFileName(controlID,fileBox) {
			if (fileBox.value){
 				var path = fileBox.value;
 				var fileName = path.substring(path.lastIndexOf('\\')+1);
				document.getElementById(controlID).value = fileName;
			}
		}
		</script>
	</head>
<body>
	<div id="page-wrapper">
		<c:import url="header.jsp"/>
		<c:import url="sidebar.jsp"/>		
		<div id="content">
			<c:import url="s_navs.jsp"/>	
			<h2>文件上传</h2>
			<c:if test="${param.error == 1}">
				<p><font color = red>错误，上传文件重名！</font></p>
			</c:if>
			<form action = "fileUpload.do" method = "post" ENCTYPE = "multipart/form-data">
			<div id="upload">
				<p>请选择要上传的文件：
				<input type = "file" name = "file" id="file" size = "25" onchange="getFileName('filename',this.form.file);" />
				</p>
				<p>文件名：
				<input type = "text" name = "title" id="filename" size = "20"/>	</p>
				<input type="hidden" name="type" value="3"/>
				<p>请简短描述上传文件：</p>
				<textarea name="content" cols="50" rows="10"></textarea>
				<br />
					<input type = "submit" value = "提交"/>
			</div>
			</form>
		</div>
		<c:import url="footer.jsp"/>
	</div>	
</body>
</html>